package gameObjects;

import castlewarserver.GameParams;
import castlewarserver.XmlSerializer;

public class GameObject implements Comparable<GameObject> {

	protected int id;
	protected String player;
	protected boolean changed = false;
	protected int x;
	protected int y;
	protected String imageString;
	protected String objectType;

	public GameObject(){
		GameParams params = XmlSerializer.deserializeGameParams("gameparams.xml");
		params.setObjCounter(params.getObjCounter() + 1);
		id = params.getObjCounter();
		XmlSerializer.serializeGameParams(params, "gameparams.xml");
	}


	public String getPlayer() {
		return player;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	public boolean isChanged() {
		return changed;
	}
	public void setChanged(boolean changed) {
		this.changed = changed;
	}
	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}

	public String getImageString() {
		return imageString;
	}
	public void setImageString(String imageString) {
		this.imageString = imageString;
	}
	public String getObjectType() {
		return objectType;
	}
	public void setObjectType(String objectType) {
		this.objectType = objectType;
	}
	@Override
	public int compareTo(GameObject obj) {

		return this.id-obj.getId();
	}


}
